Skip to content

Restructure Claude review: remove static analysis, add CI-informed follow-up#728

Open
AlexKantor87 wants to merge 1 commit intomainfrom
claude-review-two-pass
Open

Restructure Claude review: remove static analysis, add CI-informed follow-up#728
AlexKantor87 wants to merge 1 commit intomainfrom
claude-review-two-pass

Conversation

@AlexKantor87
Copy link
Contributor

@AlexKantor87 AlexKantor87 commented Mar 24, 2026

Two-Pass Claude PR Review Architecture

Replaces the current single-pass Claude review workflow with a two-pass architecture that separates code review from CI failure analysis.

Why

Team feedback identified that the previous workflow duplicated static analysis already run by the pipeline. Instead of having Claude run its own go build, go vet, and go mod tidy checks, this approach lets the existing CI pipeline do what it's good at, and has Claude analyse the results.

How It Works

Pass 1 — Code Review (on PR open/update)

  • Triggers on pull_request events (opened, synchronize, reopened)
  • Claude reviews the diff for logic bugs, security issues, design concerns, and good patterns
  • Explicitly does NOT run static analysis tools — focuses on what humans (and LLMs) are good at
  • Uses Opus model for deeper reasoning

Pass 2 — CI Failure Analysis (after pipeline fails)

  • Triggers via workflow_run when the "Main" workflow completes with a failure
  • Resolves the PR number from the branch name using gh pr list
  • Claude reads the failed job logs (gh run view --log-failed) and correlates with the PR diff
  • Posts a targeted follow-up comment identifying which PR changes likely caused the failure
  • Uses Sonnet model for focused log analysis
  • Only fires on failure — no noise on green builds

Key Design Decisions

  • No Go toolchain setup in either pass — Claude never runs build/lint/vet
  • Separate models: Opus for nuanced code review, Sonnet for structured log analysis
  • Sticky comment for Pass 1 (updates in place), regular comment for Pass 2 (appends)
  • Concurrency groups prevent duplicate reviews on rapid pushes
  • Pass 2 skips non-PR branches (e.g., direct pushes to main)

Testing

  • Close and reopen this PR to trigger Pass 1
  • Push a commit that breaks the build to test Pass 2
  • Verify both comments appear correctly on the PR

…ed follow-up

Pass 1 (pull_request): Fast code review without static analysis.
  - Removes Go setup step and go build/vet from allowed tools
  - Claude focuses on logic, security, design, and testing
  - Fires immediately on PR open/sync

Pass 2 (workflow_run): CI-informed follow-up after Main pipeline completes.
  - Resolves which PR the pipeline run belongs to
  - Reads pipeline results via gh pr checks / gh run view
  - If CI failed: Claude analyses failures against the PR diff
    and posts a targeted follow-up comment
  - If CI passed: no action (avoids noise)
@AlexKantor87 AlexKantor87 enabled auto-merge (squash) March 24, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant